// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
 * @file TwistStamped.c
 * This source file contains the definition of the described types in the IDL file.
 *
 * This file was generated by the tool gen.
 */

#include "TwistStamped.h"

#include <ucdr/microcdr.h>
#include <string.h>

bool Twist_serialize_topic(ucdrBuffer* writer, const Twist* topic)
{
    bool success = true;

        success &= geometry_msgs_msg_Vector3_serialize_topic(writer, &topic->linear);
        success &= geometry_msgs_msg_Vector3_serialize_topic(writer, &topic->angular);
    return success && !writer->error;
}

bool Twist_deserialize_topic(ucdrBuffer* reader, Twist* topic)
{
    bool success = true;

        success &= geometry_msgs_msg_Vector3_deserialize_topic(reader, &topic->linear);
        success &= geometry_msgs_msg_Vector3_deserialize_topic(reader, &topic->angular);
    return success && !reader->error;
}

uint32_t Twist_size_of_topic(const Twist* topic, uint32_t size)
{
    uint32_t previousSize = size;
        size += geometry_msgs_msg_Vector3_size_of_topic(&topic->linear, size);
        size += geometry_msgs_msg_Vector3_size_of_topic(&topic->angular, size);
    return size - previousSize;
}

bool geometry_msgs_msg_TwistStamped_serialize_topic(ucdrBuffer* writer, const geometry_msgs_msg_TwistStamped* topic)
{
    bool success = true;

        success &= std_msgs_msg_Header_serialize_topic(writer, &topic->header);
        success &= Twist_serialize_topic(writer, &topic->twist);
    return success && !writer->error;
}

bool geometry_msgs_msg_TwistStamped_deserialize_topic(ucdrBuffer* reader, geometry_msgs_msg_TwistStamped* topic)
{
    bool success = true;

        success &= std_msgs_msg_Header_deserialize_topic(reader, &topic->header);
        success &= Twist_deserialize_topic(reader, &topic->twist);
    return success && !reader->error;
}

uint32_t geometry_msgs_msg_TwistStamped_size_of_topic(const geometry_msgs_msg_TwistStamped* topic, uint32_t size)
{
    uint32_t previousSize = size;
        size += std_msgs_msg_Header_size_of_topic(&topic->header, size);
        size += Twist_size_of_topic(&topic->twist, size);
    return size - previousSize;
}
